//
//  SASpendingSummaryCell.m
//  yidiantong
//
//  Created by 黄志刚 on 2021/1/8.
//

#import "SASpendingSummaryCell.h"

@interface SASpendingSummaryCell ()

@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UILabel *typeLab;
@property (nonatomic, strong) UIView *line;

@end

@implementation SASpendingSummaryCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)setDic:(NSDictionary *)dic {
    _dic = dic;
    [dic enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
        _nameLab.text = key;
        _typeLab.text = obj;
    }];
}

-(void)initUI {
    self.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.nameLab];
    [self.contentView addSubview:self.typeLab];
    [self.contentView addSubview:self.line];
}

#pragma mark - lazy
- (UILabel *)nameLab {
    if (!_nameLab) {
        _nameLab = [[UILabel alloc] initWithFrame:SARectMake(25, 0, 150, 40)];
        _nameLab.textColor = kBlackColor;
        _nameLab.font = kFont(15);
        _nameLab.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLab;
}

- (UILabel *)typeLab {
    if (!_typeLab) {
        _typeLab = [[UILabel alloc] initWithFrame:SARectMake(200, 0, 150, 40)];
        _typeLab.textColor = kBlackColor;
        _typeLab.font = kFont(15);
        _typeLab.textAlignment = NSTextAlignmentRight;
    }
    return _typeLab;
}

-(UIView *)line {
    if (!_line) {
        _line = [[UIView alloc] initWithFrame:CGRectMake(0, kScaleNum(40), kScreenWidth, kScaleNum(0.5))];
        _line.backgroundColor = kLineColor;
    }
    return _line;
}

@end
